package cn.edu.bupt.scidata.mapper;

import cn.edu.bupt.scidata.model.project.MySQLProject;
import cn.edu.bupt.scidata.model.project.Results;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ProjectsMapper {

    @Select("SELECT * FROM projects WHERE approval = #{approval}")
    MySQLProject getByApproval(@Param(value = "approval") String approval);

    @Select("SELECT * FROM results WHERE project = #{approval} order by kind, time desc")
    List<Results> getResultsByApproval(@Param(value = "approval") String approval);

    @Select("SELECT * FROM projects WHERE manager = #{manager} and institute = #{institute} order by origin")
    List<MySQLProject> getResearcherProjects(@Param(value = "manager") String manager, @Param(value = "institute") String institute);
}
